package com.hj.saapp.control.adapter;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.hj.saapp.BCDApplication;
import com.hj.saapp.R;

import java.util.ArrayList;

/**
 * Created by Administrator on 2015/10/16.
 */
public class ListDialogAdapter extends BaseAdapter{

    ArrayList<String> mData;
    public ListDialogAdapter(ArrayList<String> mData)
    {
        this.mData = mData;
    }

    @Override
    public int getCount() {
        return  this.mData.size();
    }

    @Override
    public Object getItem(int position) {
        return  this.mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {


        View view = LayoutInflater.from(BCDApplication.getApp()).inflate(R.layout.view_list_dialog_adapter_item,null);

        TextView textView = (TextView)view.findViewById(R.id.text);
        if ("嫌疑人".equals(mData.get(position)) || "报警人".equals(mData.get(position)) || "办案民警".equals(mData.get(position))) {

            textView.setTextColor(Color.parseColor("#888888"));

        } else {
            textView.setTextColor(Color.parseColor("#333333"));
        }

        textView.setText(mData.get(position));

        return view;
    }
}
